package com.bicon.botu.mall.member.api;

import com.bicon.botu.core.base.common.controller.BaseController;
import com.bicon.botu.core.base.common.entity.BaseResult;
import com.bicon.botu.mall.member.dto.DefaultAddressDto;
import com.bicon.botu.mall.member.service.IAddressService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 地址信息Api
 *
 * @author JsonLi
 * @date ${date}
 */
@Slf4j
@RestController
@RequestMapping("/V3.0.0/api/Address")
public class AddressApiV3 extends BaseController {
    @Autowired
    private IAddressService iAddressService;
    /**
     * 查询默认的收货地址
     */
    @RequestMapping("/default-address")
    public BaseResult selectDefaultAddress(@RequestParam String userId){
        if (StringUtils.isEmpty(userId)){
            return new BaseResult(400,"参数错误");
        }
        DefaultAddressDto defaultAddressDto = iAddressService.selectDefaultAddress(userId);
        return new BaseResult(200,"success",defaultAddressDto);
    }

}
